#!/usr/bin/python
# Filename: 16.py
import calendar

for year in range(1006, 1997):
	if(year%10 == 6 and calendar.isleap(year) and 
		calendar.weekday(year, 1, 26) == 0):
		print year
#mozart